// animation.js
/**
 * X轴滑动渐入动画
 */
function fadeXAnimation(_this, param, px, opacity,isYX) {
  let animation = wx.createAnimation({
    duration: 1500,
    timingFunction: 'linear',
  });
  if ('X'==isYX.toUpperCase()) {
    animation
    .translateX(px)
    .opacity(opacity)
    .step();
    _this[param] = animation.export();
    return
  }
  animation
    .translateY(px)
    .opacity(opacity)
    .step();
    _this[param] = animation.export();


}
function heightAnimation(_this, param, rpx) {
  let animation = wx.createAnimation({
    delay:2000,
    duration: 3000,
    timingFunction: 'ease',
  });
  animation
    .height(rpx)
    .step();
    _this[param] = animation.export();
}
function widthAnimation(_this, param, rpx) {
  let animation = wx.createAnimation({
    delay:1500,
    duration: 800,
    timingFunction: 'ease',
  });
  animation
    .width(rpx)
    .step();
    _this[param] = animation.export();
}

module.exports = {
  fadeXAnimation,
  heightAnimation,
  widthAnimation
};
